package com.hu.eurekaservice.until;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;

/**
 * @Author lsp
 * @Date 2020/3/3 16:36
 * @Version 1.0
 */
public class ThreadMxBeanTest {

    public static void main(String[] args) {
        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
        ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(false,false);

        for (ThreadInfo threadInfo:threadInfos){
            System.out.println(threadInfo.getThreadId()+"["+threadInfo.getThreadName()+"]");
        }

    }


}
